<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7"/>
    <title>悦定内容管理系统</title>

    <!--判断是否登陆-->
    <script type="text/javascript" src="../../vendor/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="../../js/config.js"></script>
    <script type="text/javascript" src="../../js/jquerySession.js"></script>
    <script type="text/javascript">
        if ($.session.get('token') == null) {
            alert("用户未登录！");
            window.location.href = "../../login.html"
        }
    </script>

    <link href="../../css/reset.css" rel="stylesheet" type="text/css"/>
    <link href="../../css/system.css" rel="stylesheet" type="text/css"/>
    <link href="../../css/table_form.css" rel="stylesheet" type="text/css"/>
    <link href="../../css/default.css" rel="stylesheet" type="text/css">
    <link rel="alternate stylesheet" type="text/css" href="../../css/styles2.css" title="styles2" media="screen">
    <link rel="alternate stylesheet" type="text/css" href="../../css/styles3.css" title="styles3" media="screen">
    <link rel="alternate stylesheet" type="text/css" href="../../css/styles4.css" title="styles4" media="screen">
    <script language="javascript" type="text/javascript" src="../../vendor/jquery.min.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/admin_common.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/styleswitch.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/formvalidator.js" charset="UTF-8"></script>
    <script language="javascript" type="text/javascript" src="../../js/formvalidatorregex.js" charset="UTF-8"></script>
    <script type="text/javascript" charset="utf-8" src="../../vendor/kindeditor-all.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../vendor/zh-CN.js"></script>
    <script type="text/javascript">
        window.focus();
    </script>
    <style type="text/css">
        html {
            _overflow-y: scroll
        }

        .myTable{

            text-align: center;
            border: 0px;

        }

        .myTable thead{

            font-family: '微软雅黑';
            font-weight: 900;
            font-size: 14px;
            background: #f5f6fa;
            color: #4f6b72;

        }

        .myTable tbody td{
            font-family: '微软雅黑';
            width: 50%;
            color: #797268;

        }

        .deleteStyle{

            color: #09c;

        }


    </style>
    <script type="text/javascript">
        var teamId;
        $(function () {
            function getUrlParam(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }
            teamId = getUrlParam("teamId");
            var hidden = $("#teamId");
            hidden.val(teamId);

            $.getJSON(baseUrl + "/teams/" + teamId + "/members", function (json) {
                if (json.meta.code == "200") {
                    var data = json.data;
                    var tbody = $("#member_list");
                    tbody.empty();
                    $.each(data, function (i, item) {
                        var tr = "";
                        tr += "<tr id='" + item.id + "'>";

                        tr += "<td>";
                        tr += item.realName;
                        tr += "</td>";

                        tr += "<td>";
                        tr += "<a href='javascript:' onclick='deleteMember(" + item.id + ")' class='deleteStyle'> 删除</a>";
                        tr += "</td>";

                        tr += "</tr>";
                        tbody.append(tr);
                    })
                }
            });

        });

        function deleteMember(memberId) {
            if (confirm("确定删除该成员？")) {
                $.get(baseUrl + "/teams/" + teamId + "/members/" + memberId + "", function (json) {
                    var tbody = $("#member_list");
                    if (json.meta.code == "200") {
                        tbody.find("#" + memberId + "").remove();
                    }
                })
            }
        }
    </script>
</head>
<body>
<form name="myform" id="myform" action="#" method="post">
    <div class="pad-10">
        <div class="col-tab">
            <div class="contentList pad-10" style="border: 0px">
                <table width="100%" class="table_form myTable" >
                    <thead>
                    <tr>
                        <td>成员</td>
                        <td>操作</td>
                    </tr>
                    </thead>
                    <tbody id="member_list" style="text-align: center">
                    <tr>
                        <td>成员</td>
                        <td>操作</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <hr style="margin-top: 10px;margin-bottom: 10px"/>
            <div class="contentList pad-10" style="border: 0px">
                <form class="table_form " method="post" action="#">
                    <table width="100%" class="table_form myTable">
                        <tr style="display: none">
                            <td><input type="text" name="teamId" id="teamId"/></td>
                        </tr>
                        <tr>
                            <td><span>姓名</span></td>
                            <td><input type="text" name="realName" class="realName"/></td>
                        </tr>
                        <tr>
                            <td><span>性别</span></td>
                            <td><input type="text" name="gender" class="gender"/></td>
                        </tr>
                        <tr>
                            <td><span>电话号码</span></td>
                            <td><input type="text" name="phoneNumber" class="phoneNumber"/></td>
                        </tr>
                        <tr>
                            <td><span>身份证号码</span></td>
                            <td><input type="text" name="idNumber" class="idNumber"/></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</form>

</body>
</html>